<?php
class Ajax extends MX_Controller {
    var $_data = array();
    function  __construct() {
        parent::__construct();
        $this->load->helper('form');
    }
    
    function _loailkmt(){        
        $list_llk = $this->db->get('loailinhkien')->result();
        if(!empty($list_llk)){
            foreach($list_llk as $tt){
                $this->_data['listllkmt'][$tt->llk_id]= $tt->llk_name;
            }
        }
    }
    
    function _phongmay(){
        $list_trangthai = $this->db->get('pm')->result();
        if(!empty($list_trangthai)){
            foreach($list_trangthai as $tt){
                $this->_data['listpm'][$tt->pm_id]= $tt->pm_name;
            }
        }
    }
    
    function _linhkienmaytinh(){
        $list_ = $this->db->get('linhkien_maytinh')->result();
        if(!empty($list_)){
            foreach($list_ as $tt){
                $this->_data['listltmt'][$tt->id_llk][$tt->id]= $tt;
            }
        }
    }
    
    

    function login() {
        /*$output = array(
            'result' => 'failed',
            'username' => '',
            'password' => ''
        );
        
        $username = $this->input->post('username');
        $password = $this->input->post('password');
        if ($username == '') {
            $output['username'] = __('Please enter your username / email');
        } else {
            $account = $this->account_model->get_account(array('username' => $username));
            if (!$account) {
                $account = $this->account_model->get_account(array('email' => $username));
                if (!$account) {
                    $output['username'] = __('Username / email does not exist');
                }
            }

            if ($account) {
                $account = $this->account_model->get_account(array('email' => $username,'password'=>$password));
                if ($account) {
                    $this->authentication->sign_in($account->id); 
                    $output['result'] = 'success';
                } else {
                    $output['password'] = __('Wrong password');
                }
            }
        }
        echo json_encode($output);
       */ 
    }
}

?>
